home *** CD-ROM | disk | FTP | other *** search
- /* $VER: Fetch 1.5 (01.09.96) (c) Neil Bothwick */
- /* */
- /* Gets mail and/or news, retrying until a connection */
- /* is made or a maximum number of retries is reached */
-
- /* Change these to suit your setup */
-
- SystemName = 'Wirenet' /* The name of your Internet system in Thor */
- NumSockets = 2 /* The number of sockets for Thor to use */
- MaxTries = 5 /* Maximum number of retries */
- Logging = 0 /* Set to 1 to enable logging, 0 to disable it */
- /* DO NOT use logging unless you have at least Thor 2.3 */
- LogFile = 'UUSpool:Connect.log'
-
- /* Don't change anything below here */
-
- arg option
-
- if ~show('L','rexxdossupport.library') then
- call addlib('rexxdossupport.library',0,-30)
-
- options results
- address command
- options failat 21
-
- /* :Check to see if fetch is already running */
- if exists('ENV:FetchState') then call ExitMsg('Fetch is already collecting' GetVar('FetchState'))
- ;;
- /* :Read password from PAP config */
- Password = subword(GetVar('Wirenet/pap.config'),2)
- ;;
- /* :Build command string */
- CmdStr = GetVar('Thor/ThorPath')'bin/GetTCP' SystemName 'PUBSCREEN Workbench GETONLY'
- MailStr = 'DELETE PASSWORD' Password 'MAILSERVER $MAILSERVER USERNAME $MAILBOX'
- NewsStr = 'NEWSSERVER $NEWSSERVER SOCKETS' NumSockets
-
- select
- when option = 'MAIL' then do
- CmdStr = CmdStr 'NONEWS' MailStr
- 'setenv FetchState mail'
- end
- when option = 'NEWS' then do
- CmdStr = CmdStr 'NOMAIL' NewsStr
- 'setenv FetchState news'
- end
- when option = 'ALL' then do
- CmdStr = CmdStr MailStr NewsStr
- 'setenv FetchState mail & news'
- end
- otherwise ExitMsg('Usage: Fetch Mail|News|All')
- end
-
- if Logging = 1 then CmdStr = CmdStr 'LOGFILE' LogFile
- ;;
- /* :Call ParseThor to remove any batched mail or news in tcp_tmp */
- 'AmiTCP:bin/ParseThor'
- ;;
- /* :Call GetTCP until successful or max retries reached */
- do try = 1 to MaxTries
- CmdStr
- if RC=0 then do
- leave try
- end
- end
-
- 'unsetenv FetchState'
-
- if try > MaxTries then ExitMsg('Failed to get mail after' MaxTries 'attempts')
- ;;
-
- exit
-
- ExitMsg: Procedure
- parse arg Msg
- say
- say(Msg)
- say
- exit
- return
-
-